package edu.illuminaty.websteganographyserver.rest;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.sun.jersey.spi.resource.Singleton;

import edu.illuminaty.websteganographyserver.dataprovider.DataProvider;

@Singleton
@Path("/change")
public class ChangeMessageService {
	DataProvider dataProvider = DataProvider.getInstace();

	@POST
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	@Path("/changeMessage")
	public Response changeMessage(@FormParam("message") String newMessage, @Context HttpServletResponse response){
		dataProvider.setMessage(newMessage);
		return Response.ok().build();
	}
}
